package com.heima.wemedia.delay;

import com.heima.common.delayTask.RedisDelayQueueHandler;
import com.heima.wemedia.service.WmNewsAuditService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 延迟发布文章
 */
@Slf4j
@Component
public class PublicNewsDelayHandler implements RedisDelayQueueHandler<Integer> {

    @Autowired
    private WmNewsAuditService wmNewsAuditService;
    @Override
    public void execute(Integer id) {
		if(id==0){
            log.info("id={},无用元素，直接返回");
            return ;
        }
        log.info("延迟消息redis中的id=={}",id);
        wmNewsAuditService.pubWmNews(id);
    }
}